<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class AdminPermission extends Model
{
    protected $table = 'admin_permissions';
    protected $primaryKey = 'id';
    protected $fillable = ['name','description'];

    //权限属于哪个角色
    public function roles() {
        return $this->belongsToMany(AdminRole::class,'admin_role_permission','role_id','permission_id')
            ->withPivot('role_id','permission_id');
    }
}
